#sample Input Method that reverse uppercase & lowercase
import VineUtil
class IMEClass(VineUtil.IMEBase):
	def call_back(self, sym, state, id):
		if id == self._lower : sym -= 32 
		else : sym += 32
		self.Commit(chr(sym))
		return VineUtil.FE_SUCCEED
	def PreeditTextChanged(self,text):
		self.Commit(text)
	def Enabled(self):
		sym_range = (ord('a'),ord('z')+1)
		state     = VineUtil.StateFilter()
		state.DisallowModifier(VineUtil.IMStateAll)
		state.AllowModifier(VineUtil.IMStateShift)
		state.AllowModifier(VineUtil.IMStateCaps)
		self._lower = self.RegisterForwardFilter(sym_range,state,
							 VineUtil.IMKeyActionPress,
							 IMEClass.call_back)
		sym_range = (ord('A'),ord('Z')+1)
		self._upper = self.RegisterForwardFilter(sym_range,state,
							 VineUtil.IMKeyActionPress,
							 IMEClass.call_back)
def Create(): return IMEClass()
